package top.zhangjianyong.tools.model;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

import java.io.Serializable;

@Data
public class EtfDeliveryQuery implements Serializable {

    private String unit = "weeks";
    private Integer num = 3;
    private Integer type = 6;
    private String sortKey;
    private String sortDir;
    private String code;
    private Integer holdFlag;
    private Boolean onlyHolding;
    private Boolean onlyOpportunity;
    private String opportunityType;

    public void normalize() {
        if (StrUtil.isBlank(unit)) {
            unit = "weeks";
        }
        if (num == null || num <= 0) {
            num = 3;
        }
        if (type == null) {
            type = 6;
        }
        if (StrUtil.isBlank(sortKey)) {
            sortKey = null;
        }
        if (StrUtil.isBlank(sortDir)) {
            sortDir = null;
        }
    }
}

